package utils

import (
	"math/rand"
	"time"
)

const CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
const charCount = len(CHARACTERS) // 编译期常量
func init() {
	rand.Seed(time.Now().UnixNano())
}
func GenerateRandom() string {
	return generateRandom(6)
}

func generateRandom(length int) string {
	buf := make([]byte, length)

	for i := range buf {
		buf[i] = CHARACTERS[rand.Intn(charCount)]
	}
	return string(buf)
}
